/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import DAO.*;
import DTO.*;
import java.util.List;

import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.regex.*;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;



import java.awt.event.*;

import java.sql.*;
import java.text.SimpleDateFormat;

import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.DefaultComboBoxModel;
//import sun.security.provider.PolicyParser;

/**
 *
 * @author Luis Olave 10
 */
public class ModificacionGarante extends javax.swing.JFrame {

    Connection conexion, conexion2;
    Statement st, st2;
    ResultSet rs, rs2;
    DefaultComboBoxModel modeloCombo6 = new DefaultComboBoxModel(); //region particular
    DefaultComboBoxModel modeloCombo7 = new DefaultComboBoxModel(); // comuna particular
    Connection conexionn, conexion3;
    Statement stt, st3;
    ResultSet rss, rs3;
    DefaultComboBoxModel modeloCombo8 = new DefaultComboBoxModel(); // region trabajo
    DefaultComboBoxModel modeloCombo9 = new DefaultComboBoxModel(); // comuna trabajo 
    usuarioDTO user;
    garantiasDAO reg = new garantiasDAO();

    public ModificacionGarante(usuarioDTO user) {
        initComponents();
        this.user = user;
        llenar_region_particular();
        // llenar_region_trabajo();
this.setDefaultCloseOperation(this.EXIT_ON_CLOSE);
        this.cmbRegionParti.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg) {
                llenar_comuna_particular((String) cmbRegionParti.getSelectedItem().toString());
            }
        });

        llenar_region_trabajo();
        this.cmbRegionTrab.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg) {
                llenar_comuna_trabajo((String) cmbRegionTrab.getSelectedItem().toString());
            }
        });

    }

    public void llenar_region_particular() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            st = (Statement) conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rs = st.executeQuery("SELECT * FROM region");
            modeloCombo6.addElement("Seleccione Region");
            cmbRegionParti.setModel(modeloCombo6);
            while (rs.next()) {
                modeloCombo6.addElement(rs.getObject("nom_region"));
                cmbRegionParti.setModel(modeloCombo6);
            }

            st.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void llenar_comuna_particular(String nom_region) {
        this.cmbComunaParti.enable(true);
        this.cmbComunaParti.removeAllItems();
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexion = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            st = (Statement) conexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rs = st.executeQuery("SELECT * FROM comuna,region "
                    + "WHERE comuna.id_region=region.id_region "
                    + "AND nom_region='" + nom_region + "'");
            modeloCombo7.addElement("Seleccione Comuna");
            cmbComunaParti.setModel(modeloCombo7);
            while (rs.next()) {
                modeloCombo7.addElement(rs.getObject("nom_comuna"));
                cmbComunaParti.setModel(modeloCombo7);
            }

            st.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    ////// DIRECCION TRABAJO ////////////
    public void llenar_region_trabajo() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexionn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            stt = (Statement) conexionn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rss = stt.executeQuery("SELECT * FROM region_lugar_trab");
            modeloCombo8.addElement("Seleccione Region");
            cmbRegionTrab.setModel(modeloCombo8);
            while (rss.next()) {
                modeloCombo8.addElement(rss.getObject("nom_region_trab"));
                cmbRegionTrab.setModel(modeloCombo8);
            }

            stt.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void llenar_comuna_trabajo(String nom_region_trab) {
        this.cmbComunaTrab.enable(true);
        this.cmbComunaTrab.removeAllItems();
        try {
            Class.forName("com.mysql.jdbc.Driver");
            conexionn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/garantias", "root", "1234");
            stt = (Statement) conexionn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            rss = stt.executeQuery("SELECT * FROM comuna_lugar_trab,region_lugar_trab "
                    + "WHERE comuna_lugar_trab.id_region_trab=region_lugar_trab.id_region_trab "
                    + "AND nom_region_trab='" + nom_region_trab + "'");
            modeloCombo9.addElement("Seleccione Comuna");
            cmbComunaTrab.setModel(modeloCombo9);
            while (rss.next()) {
                modeloCombo9.addElement(rss.getObject("nom_comuna_trab"));
                cmbComunaTrab.setModel(modeloCombo9);
            }

            stt.close();
        } catch (SQLException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(IngresoGarante.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jScrollPane1 = new javax.swing.JScrollPane();
        pnlPrincipal = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        pnlIngresarDatosGarante = new javax.swing.JPanel();
        pnlDatosPersonales = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        txtApellPaterno = new javax.swing.JTextField();
        txtApellMaterno = new javax.swing.JTextField();
        txtRut = new javax.swing.JTextField();
        txtNombre = new javax.swing.JTextField();
        rdMasculino = new javax.swing.JRadioButton();
        rdFemenino = new javax.swing.JRadioButton();
        jcFechNac = new com.toedter.calendar.JDateChooser();
        pnlDireParticular = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        txtDepto = new javax.swing.JTextField();
        txtNumParti = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        txtCalleParti = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        txtPobla = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jLabel24 = new javax.swing.JLabel();
        cmbRegionParti = new javax.swing.JComboBox();
        cmbComunaParti = new javax.swing.JComboBox();
        pnlNumContacto = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        txtTelParticular = new javax.swing.JTextField();
        txtTelTrabajo = new javax.swing.JTextField();
        txtTelMovil = new javax.swing.JTextField();
        txtFax = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        txtMail = new javax.swing.JTextField();
        pnlDireTrabajo = new javax.swing.JPanel();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        jLabel25 = new javax.swing.JLabel();
        txtNomEmpresa = new javax.swing.JTextField();
        txtNumOfi = new javax.swing.JTextField();
        txtNumeroTrab = new javax.swing.JTextField();
        txtCalleTrab = new javax.swing.JTextField();
        cmbRegionTrab = new javax.swing.JComboBox();
        cmbComunaTrab = new javax.swing.JComboBox();
        btnGrabar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnMenuPrincipal = new javax.swing.JButton();
        pnlIngreseRutGarante = new javax.swing.JPanel();
        lblRut = new javax.swing.JLabel();
        txtRutBuscar = new javax.swing.JTextField();
        btnBuscar = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("MODIFICACIÓN GARANTE");
        setResizable(false);

        pnlPrincipal.setPreferredSize(new java.awt.Dimension(640, 660));

        jLabel1.setFont(new java.awt.Font("Century Gothic", 1, 18)); // NOI18N
        jLabel1.setText("MODIFICACIÓN DE GARANTES");

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/IMAGE/logo.JPG"))); // NOI18N

        pnlIngresarDatosGarante.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESAR DATOS GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 12), java.awt.Color.blue)); // NOI18N

        pnlDatosPersonales.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DATOS PERSONALES", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel3.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel3.setText("RUT");

        jLabel4.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel4.setText("APELLIDO PATERNO");

        jLabel5.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel5.setText("APELLIDO MATERNO");

        jLabel6.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel6.setText("NOMBRE");

        jLabel7.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel7.setText("FECHA NACIMIENTO");

        jLabel8.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel8.setText("SEXO");

        txtRut.setBackground(new java.awt.Color(255, 255, 102));
        txtRut.setDisabledTextColor(new java.awt.Color(0, 0, 204));
        txtRut.setEnabled(false);

        buttonGroup1.add(rdMasculino);
        rdMasculino.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        rdMasculino.setSelected(true);
        rdMasculino.setText("MASCULINO");

        buttonGroup1.add(rdFemenino);
        rdFemenino.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        rdFemenino.setText("FEMENINO");

        javax.swing.GroupLayout pnlDatosPersonalesLayout = new javax.swing.GroupLayout(pnlDatosPersonales);
        pnlDatosPersonales.setLayout(pnlDatosPersonalesLayout);
        pnlDatosPersonalesLayout.setHorizontalGroup(
            pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                        .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel8))
                        .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlDatosPersonalesLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 83, Short.MAX_VALUE)
                                .addComponent(rdMasculino)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(rdFemenino)
                                .addGap(8, 8, 8))
                            .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                                .addGap(28, 28, 28)
                                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNombre)
                                    .addComponent(jcFechNac, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addContainerGap())))
                    .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                        .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel3))
                                .addGap(32, 32, 32)
                                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(txtApellPaterno, javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtRut)
                                    .addComponent(txtApellMaterno, javax.swing.GroupLayout.Alignment.LEADING)))
                            .addComponent(jLabel7))
                        .addContainerGap())))
        );
        pnlDatosPersonalesLayout.setVerticalGroup(
            pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDatosPersonalesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtRut, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtApellPaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(txtApellMaterno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7)
                    .addComponent(jcFechNac, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDatosPersonalesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(rdMasculino)
                    .addComponent(rdFemenino)
                    .addComponent(jLabel8))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlDireParticular.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DIRECCIÓN PARTICULAR", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel11.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel11.setText("DEPTO.");

        jLabel10.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel10.setText("NÚMERO");

        jLabel9.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel9.setText("CALLE / AVENIDA");

        jLabel13.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel13.setText("POBLACIÓN / VILLA");

        jLabel23.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel23.setText("REGIÓN");

        jLabel24.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel24.setText("COMUNA");

        cmbRegionParti.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbRegionParti.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        cmbComunaParti.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbComunaParti.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        javax.swing.GroupLayout pnlDireParticularLayout = new javax.swing.GroupLayout(pnlDireParticular);
        pnlDireParticular.setLayout(pnlDireParticularLayout);
        pnlDireParticularLayout.setHorizontalGroup(
            pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDireParticularLayout.createSequentialGroup()
                        .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9)
                            .addComponent(jLabel11)
                            .addComponent(jLabel23))
                        .addGap(31, 31, 31)
                        .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                    .addComponent(txtDepto, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                                    .addComponent(txtCalleParti, javax.swing.GroupLayout.Alignment.LEADING))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtNumParti, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                                .addComponent(cmbRegionParti, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))))
                    .addGroup(pnlDireParticularLayout.createSequentialGroup()
                        .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                                .addComponent(jLabel13)
                                .addGap(18, 18, 18)
                                .addComponent(txtPobla, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                                .addComponent(jLabel24)
                                .addGap(76, 76, 76)
                                .addComponent(cmbComunaParti, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        pnlDireParticularLayout.setVerticalGroup(
            pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDireParticularLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(txtCalleParti, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(txtNumParti, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(txtDepto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel13)
                    .addComponent(txtPobla, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbRegionParti, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel23))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireParticularLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel24)
                    .addComponent(cmbComunaParti, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(49, Short.MAX_VALUE))
        );

        pnlNumContacto.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "CONTACTO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel14.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel14.setText("TEL. PARTICULAR");

        jLabel15.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel15.setText("TEL. TRABAJO ");

        jLabel16.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel16.setText("TEL. MOVIL");

        jLabel17.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel17.setText("FAX");

        jLabel26.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel26.setText("MAIL");

        javax.swing.GroupLayout pnlNumContactoLayout = new javax.swing.GroupLayout(pnlNumContacto);
        pnlNumContacto.setLayout(pnlNumContactoLayout);
        pnlNumContactoLayout.setHorizontalGroup(
            pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlNumContactoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel26)
                    .addComponent(jLabel17)
                    .addComponent(jLabel16)
                    .addComponent(jLabel15)
                    .addComponent(jLabel14))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtTelParticular)
                    .addComponent(txtTelTrabajo)
                    .addComponent(txtTelMovil)
                    .addComponent(txtFax)
                    .addComponent(txtMail, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(92, 92, 92))
        );
        pnlNumContactoLayout.setVerticalGroup(
            pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlNumContactoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel14)
                    .addComponent(txtTelParticular, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtTelTrabajo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel15))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel16)
                    .addComponent(txtTelMovil, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtFax, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel17))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlNumContactoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel26)
                    .addComponent(txtMail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pnlDireTrabajo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "DIRECCIÓN TRABAJO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        jLabel18.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel18.setText("CALLE / AVENIDA");

        jLabel19.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel19.setText("NÚMERO");

        jLabel20.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel20.setText("NÚMERO OFICINA");

        jLabel21.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel21.setText("REGIÓN");

        jLabel22.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel22.setText("COMUNA");

        jLabel25.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        jLabel25.setText("NOMBRE EMPRESA");

        cmbRegionTrab.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbRegionTrab.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        cmbComunaTrab.setFont(new java.awt.Font("Century Gothic", 0, 10)); // NOI18N
        cmbComunaTrab.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Seleccione" }));

        javax.swing.GroupLayout pnlDireTrabajoLayout = new javax.swing.GroupLayout(pnlDireTrabajo);
        pnlDireTrabajo.setLayout(pnlDireTrabajoLayout);
        pnlDireTrabajoLayout.setHorizontalGroup(
            pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDireTrabajoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlDireTrabajoLayout.createSequentialGroup()
                        .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel25)
                            .addComponent(jLabel21)
                            .addComponent(jLabel22))
                        .addGap(18, 18, 18)
                        .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(cmbRegionTrab, javax.swing.GroupLayout.Alignment.LEADING, 0, 123, Short.MAX_VALUE)
                            .addComponent(txtNomEmpresa, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cmbComunaTrab, 0, 1, Short.MAX_VALUE)))
                    .addGroup(pnlDireTrabajoLayout.createSequentialGroup()
                        .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel20)
                            .addComponent(jLabel18))
                        .addGap(21, 21, 21)
                        .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtCalleTrab, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                            .addComponent(txtNumOfi))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel19)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtNumeroTrab, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pnlDireTrabajoLayout.setVerticalGroup(
            pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDireTrabajoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(txtCalleTrab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel19)
                    .addComponent(txtNumeroTrab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtNumOfi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel20))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel25)
                    .addComponent(txtNomEmpresa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel21)
                    .addComponent(cmbRegionTrab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlDireTrabajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel22)
                    .addComponent(cmbComunaTrab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnlIngresarDatosGaranteLayout = new javax.swing.GroupLayout(pnlIngresarDatosGarante);
        pnlIngresarDatosGarante.setLayout(pnlIngresarDatosGaranteLayout);
        pnlIngresarDatosGaranteLayout.setHorizontalGroup(
            pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlIngresarDatosGaranteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlDatosPersonales, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlDireParticular, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlNumContacto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlDireTrabajo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlIngresarDatosGaranteLayout.setVerticalGroup(
            pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlIngresarDatosGaranteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlDatosPersonales, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlNumContacto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(pnlIngresarDatosGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(pnlDireParticular, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pnlDireTrabajo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(12, Short.MAX_VALUE))
        );

        btnGrabar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnGrabar.setText("GRABAR");
        btnGrabar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnGrabarActionPerformed(evt);
            }
        });

        btnCancelar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnCancelar.setText("CANCELAR");
        btnCancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelarActionPerformed(evt);
            }
        });

        btnMenuPrincipal.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnMenuPrincipal.setText("MENÚ PRINCIPAL >>");
        btnMenuPrincipal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMenuPrincipalActionPerformed(evt);
            }
        });

        pnlIngreseRutGarante.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "INGRESE RUT GARANTE", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Century Gothic", 1, 10), java.awt.Color.blue)); // NOI18N

        lblRut.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        lblRut.setText("RUT");

        btnBuscar.setFont(new java.awt.Font("Century Gothic", 0, 12)); // NOI18N
        btnBuscar.setText("BUSCAR");
        btnBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnBuscarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pnlIngreseRutGaranteLayout = new javax.swing.GroupLayout(pnlIngreseRutGarante);
        pnlIngreseRutGarante.setLayout(pnlIngreseRutGaranteLayout);
        pnlIngreseRutGaranteLayout.setHorizontalGroup(
            pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlIngreseRutGaranteLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblRut)
                .addGap(18, 18, 18)
                .addGroup(pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtRutBuscar)
                    .addComponent(btnBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE))
                .addContainerGap(52, Short.MAX_VALUE))
        );
        pnlIngreseRutGaranteLayout.setVerticalGroup(
            pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlIngreseRutGaranteLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(pnlIngreseRutGaranteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRut)
                    .addComponent(txtRutBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnBuscar)
                .addContainerGap())
        );

        jLabel12.setText("MENÚ PRINCIPAL\\MODIFICACIÓN DE GARANTES");

        javax.swing.GroupLayout pnlPrincipalLayout = new javax.swing.GroupLayout(pnlPrincipal);
        pnlPrincipal.setLayout(pnlPrincipalLayout);
        pnlPrincipalLayout.setHorizontalGroup(
            pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPrincipalLayout.createSequentialGroup()
                .addGap(220, 220, 220)
                .addComponent(btnGrabar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnCancelar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnMenuPrincipal)
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(pnlPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pnlIngresarDatosGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pnlPrincipalLayout.createSequentialGroup()
                        .addGroup(pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel12))
                        .addGroup(pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(pnlPrincipalLayout.createSequentialGroup()
                                .addGap(67, 67, 67)
                                .addComponent(pnlIngreseRutGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(pnlPrincipalLayout.createSequentialGroup()
                                .addGap(48, 48, 48)
                                .addComponent(jLabel1)))))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        pnlPrincipalLayout.setVerticalGroup(
            pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlPrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pnlPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(18, 18, 18)
                        .addComponent(jLabel12))
                    .addGroup(pnlPrincipalLayout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(pnlIngreseRutGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pnlIngresarDatosGarante, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(pnlPrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnGrabar)
                    .addComponent(btnCancelar)
                    .addComponent(btnMenuPrincipal))
                .addContainerGap(31, Short.MAX_VALUE))
        );

        jScrollPane1.setViewportView(pnlPrincipal);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 891, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)
        );

        setSize(new java.awt.Dimension(907, 715));
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
        if(ValidarRutDAO.validarRut(this.txtRutBuscar.getText().toUpperCase()))
           {
          javax.swing.JOptionPane.showMessageDialog(this, "Rut valido");
        garanteDTO garante = reg.buscarPorRut(this.txtRutBuscar.getText().trim());
        if(garante.getRut_gara().equals(""))
        {
            javax.swing.JOptionPane.showMessageDialog(null, "Garante NO EXISTE");
        }
        else
        {
            txtRut.setText(garante.getRut_gara());
            txtApellPaterno.setText(garante.getApell_paterno_gara());
            txtApellMaterno.setText(garante.getApell_materno_gara());
            txtNombre.setText(garante.getNombre_gara());
            Date aux = ConversionFechas.convertToDate(garante.getFecha_nac_gara());
            jcFechNac.setDate(aux);
            if(garante.getSexo_gara().equalsIgnoreCase("Masculino"))
            {
                rdMasculino.setSelected(true);
            }
            else
            {
                rdFemenino.setSelected(true);
            }
            txtCalleParti.setText(garante.getCalle_gara());
            txtNumParti.setText(String.valueOf(garante.getNum_gara()));
            txtDepto.setText(garante.getDepto_gara());
            txtPobla.setText(garante.getPobla_gara());
            
            txtTelParticular.setText(String.valueOf(garante.getTel_part_gara()));
            txtTelTrabajo.setText(String.valueOf(garante.getTel_trab_gara()));
            txtTelMovil.setText(String.valueOf(garante.getTel_mov_gara()));
            txtFax.setText(String.valueOf(garante.getFax_gara()));
            txtMail.setText(garante.getE_mail());
            txtCalleTrab.setText(garante.getCalle_trab_gara());
            txtNumeroTrab.setText(String.valueOf(garante.getNum_trab_gara()));
            txtNumOfi.setText(String.valueOf(garante.getNum_ofi_gara()));
            txtNomEmpresa.setText(garante.getNom_emp_gara());
            cmbRegionParti.setSelectedItem(garante.getReg_gara().toString());
            cmbComunaParti.setSelectedItem(garante.getComu_gara().toString());
            cmbRegionTrab.setSelectedItem(garante.getReg_emp_gara().toString());
            cmbComunaTrab.setSelectedItem(garante.getComu_emp_gara().toString());
        }}else
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Rut invalido");
        }
    }//GEN-LAST:event_btnBuscarActionPerformed

    private void btnMenuPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMenuPrincipalActionPerformed
        MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
        venMenuPrincipal.setVisible(true);
        ModificacionGarante.this.dispose();
    }//GEN-LAST:event_btnMenuPrincipalActionPerformed

    private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
       txtCalleParti.setText(null);
            txtNumParti.setText(null);
            txtDepto.setText(null);
            txtPobla.setText(null);
            txtTelParticular.setText(null);
            txtTelTrabajo.setText(null);
            txtTelMovil.setText(null);
            txtFax.setText(null);
            txtMail.setText(null);
            txtCalleTrab.setText(null);
            txtNumeroTrab.setText(null);
            txtNumOfi.setText(null);
            txtNomEmpresa.setText(null);
            txtRut.setText(null);
            txtApellPaterno.setText(null);
            txtApellMaterno.setText(null);
            txtNombre.setText(null);
            jcFechNac.setCalendar(null);
            rdMasculino.setSelected(true);
            txtRutBuscar.setText(null);
        this.cmbComunaParti.setSelectedItem("Seleccione Comuna");
        this.cmbComunaTrab.setSelectedItem("Seleccione Comuna");
        this.cmbRegionParti.setSelectedItem("Seleccione Region");
        this.cmbRegionTrab.setSelectedItem("Seleccione Region");
    }//GEN-LAST:event_btnCancelarActionPerformed

    private void btnGrabarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarActionPerformed
        garanteDTO garante = new garanteDTO();
        if (this.txtApellPaterno.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Apellido Paterno");
        } else if (this.txtApellMaterno.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Apellido Materno");
        } else if (this.txtNombre.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Nombre");
        } else if (this.txtCalleParti.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Calle / Avenida Particular");
        } else if (this.txtNumParti.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Número Particular");
        } else if (this.txtMail.getText().length() == 0) // validamos campos vacios
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese Ingrese E-Mail");
        } else if (!this.txtMail.getText().matches("^[a-zA-Z0-9_-]{2,}@[a-zA-Z0-9_-]{2,}\\.[a-zA-Z]{2,4}(\\.[a-zA-Z]{2,4})?$")) // expresiones regulares para validar
        {
            javax.swing.JOptionPane.showMessageDialog(this, "Ingrese e-mail valido");
            this.txtMail.setText(" ");
        } else {
            garante.setRut_gara(this.txtRut.getText().trim());
            garante.setApell_paterno_gara(this.txtApellPaterno.getText().trim());
            garante.setApell_materno_gara(this.txtApellMaterno.getText().trim());
            garante.setNombre_gara(this.txtNombre.getText().trim());
            garante.setFecha_nac_gara(new SimpleDateFormat("dd/MM/yyyy").format(this.jcFechNac.getDate()));

            String sexo = "";
            if (this.rdMasculino.isSelected()) {
                sexo = "Masculino";
            }
            if (this.rdFemenino.isSelected()) {
                sexo = "Femenino";
            }
            garante.setSexo_gara(sexo);
            garante.setCalle_gara(this.txtCalleParti.getText().trim());
            garante.setNum_gara(Integer.parseInt(this.txtNumParti.getText().trim()));
            garante.setDepto_gara(this.txtDepto.getText().trim());
            garante.setPobla_gara(this.txtPobla.getText().trim());
            garante.setReg_gara(this.cmbRegionParti.getSelectedItem().toString());
            garante.setComu_gara(this.cmbComunaParti.getSelectedItem().toString());
            garante.setTel_part_gara(Integer.parseInt(this.txtTelParticular.getText().trim()));
            garante.setTel_trab_gara(Integer.parseInt(this.txtTelTrabajo.getText().trim()));
            garante.setTel_mov_gara(Integer.parseInt(this.txtTelMovil.getText().trim()));
            garante.setFax_gara(Integer.parseInt(this.txtFax.getText().trim()));
            garante.setE_mail(this.txtMail.getText().trim());
            garante.setCalle_trab_gara(this.txtCalleTrab.getText().trim());
            garante.setNum_trab_gara(Integer.parseInt(this.txtNumeroTrab.getText().trim()));
            garante.setNum_ofi_gara(this.txtNumOfi.getText().trim());
            garante.setNom_emp_gara(this.txtNomEmpresa.getText().trim());
            garante.setReg_emp_gara(this.cmbRegionTrab.getSelectedItem().toString());
            garante.setComu_emp_gara(this.cmbComunaTrab.getSelectedItem().toString());
            
            int respuesta = javax.swing.JOptionPane.showConfirmDialog(null, "Esta seguro de modificar este Garante ?", "Actualizar Datos", JOptionPane.OK_CANCEL_OPTION);
            //Si acepta
            if(respuesta == 0)
            {
                reg.modificarGarante(garante, user);
                javax.swing.JOptionPane.showMessageDialog(this, "Garante Modificado");
                MenuPrincipal venMenuPrincipal = new MenuPrincipal(user);
                venMenuPrincipal.setVisible(true);
                ModificacionGarante.this.dispose();
            }
        }
    }//GEN-LAST:event_btnGrabarActionPerformed
    /**
     * @param args the command line arguments
     */
//    public static void main(String args[]) {
//        /*
//         * Set the Nimbus look and feel
//         */
//        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//        /*
//         * If Nimbus (introduced in Java SE 6) is not available, stay with the
//         * default look and feel. For details see
//         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
//         */
//        try {
//            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
//                if ("Nimbus".equals(info.getName())) {
//                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
//                    break;
//                }
//            }
//        } catch (ClassNotFoundException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarante.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (InstantiationException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarante.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (IllegalAccessException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarante.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
//            java.util.logging.Logger.getLogger(ModificacionGarante.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
//        }
//        //</editor-fold>
//
//        /*
//         * Create and display the form
//         */
//        java.awt.EventQueue.invokeLater(new Runnable() {
//
//            public void run() {
//                new ModificacionGarante().setVisible(true);
//            }
//        });
//    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBuscar;
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnGrabar;
    private javax.swing.JButton btnMenuPrincipal;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JComboBox cmbComunaParti;
    private javax.swing.JComboBox cmbComunaTrab;
    private javax.swing.JComboBox cmbRegionParti;
    private javax.swing.JComboBox cmbRegionTrab;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JScrollPane jScrollPane1;
    private com.toedter.calendar.JDateChooser jcFechNac;
    private javax.swing.JLabel lblRut;
    private javax.swing.JPanel pnlDatosPersonales;
    private javax.swing.JPanel pnlDireParticular;
    private javax.swing.JPanel pnlDireTrabajo;
    private javax.swing.JPanel pnlIngresarDatosGarante;
    private javax.swing.JPanel pnlIngreseRutGarante;
    private javax.swing.JPanel pnlNumContacto;
    private javax.swing.JPanel pnlPrincipal;
    private javax.swing.JRadioButton rdFemenino;
    private javax.swing.JRadioButton rdMasculino;
    private javax.swing.JTextField txtApellMaterno;
    private javax.swing.JTextField txtApellPaterno;
    private javax.swing.JTextField txtCalleParti;
    private javax.swing.JTextField txtCalleTrab;
    private javax.swing.JTextField txtDepto;
    private javax.swing.JTextField txtFax;
    private javax.swing.JTextField txtMail;
    private javax.swing.JTextField txtNomEmpresa;
    private javax.swing.JTextField txtNombre;
    private javax.swing.JTextField txtNumOfi;
    private javax.swing.JTextField txtNumParti;
    private javax.swing.JTextField txtNumeroTrab;
    private javax.swing.JTextField txtPobla;
    private javax.swing.JTextField txtRut;
    private javax.swing.JTextField txtRutBuscar;
    private javax.swing.JTextField txtTelMovil;
    private javax.swing.JTextField txtTelParticular;
    private javax.swing.JTextField txtTelTrabajo;
    // End of variables declaration//GEN-END:variables
}
